bl31/aarch64/runtime_exceptions.S \
bl31/bl31_context_mgmt.c \
common/runtime_svc.c \
- lib/aarch64/setjmp.S \
lib/cpus/aarch64/dsu_helpers.S \
plat/common/aarch64/platform_mp_stack.S \
services/arm_arch_svc/arm_arch_svc_setup.c \
+++ /dev/null
-/*
- * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef SETJMP_H
-#define SETJMP_H
-
-#define JMP_CTX_X19 0x0
-#define JMP_CTX_X21 0x10
-#define JMP_CTX_X23 0x20
-#define JMP_CTX_X25 0x30
-#define JMP_CTX_X27 0x40
-#define JMP_CTX_X29 0x50
-#define JMP_CTX_SP 0x60
-#define JMP_CTX_END 0x70 /* Aligned to 16 bytes */
-
-#define JMP_SIZE (JMP_CTX_END >> 3)
-
-#ifndef __ASSEMBLY__
-
-#include <cdefs.h>
-#include <stdint.h>
-
-/* Jump buffer hosting x18 - x30 and sp_el0 registers */
-typedef uint64_t jmp_buf[JMP_SIZE] __aligned(16);
-
-int setjmp(jmp_buf env);
-__dead2 void longjmp(jmp_buf env, int val);
-
-#endif /* __ASSEMBLY__ */
-#endif /* SETJMP_H */
--- /dev/null
+/*
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SETJMP__H
+#define SETJMP__H
+
+#define JMP_CTX_X19 0x0
+#define JMP_CTX_X21 0x10
+#define JMP_CTX_X23 0x20
+#define JMP_CTX_X25 0x30
+#define JMP_CTX_X27 0x40
+#define JMP_CTX_X29 0x50
+#define JMP_CTX_SP 0x60
+#define JMP_CTX_END 0x70 /* Aligned to 16 bytes */
+
+#define JMP_SIZE (JMP_CTX_END >> 3)
+
+#ifndef __ASSEMBLY__
+
+#include <cdefs.h>
+
+/* Jump buffer hosting x18 - x30 and sp_el0 registers */
+typedef uint64_t jmp_buf[JMP_SIZE] __aligned(16);
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* SETJMP__H */
--- /dev/null
+/*
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SETJMP_H
+#define SETJMP_H
+
+#include <setjmp_.h>
+
+#ifndef __ASSEMBLY__
+
+#include <cdefs.h>
+
+int setjmp(jmp_buf env);
+__dead2 void longjmp(jmp_buf env, int val);
+
+#endif /* __ASSEMBLY__ */
+#endif /* SETJMP_H */
+++ /dev/null
-/*
- * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <asm_macros.S>
-#include <assert_macros.S>
-#include <setjmp.h>
-
- .globl setjmp
- .globl longjmp
-
-/*
- * int setjmp(jmp_buf env);
- */
-func setjmp
- mov x7, sp
-
- stp x19, x20, [x0, #JMP_CTX_X19]
- stp x21, x22, [x0, #JMP_CTX_X21]
- stp x23, x24, [x0, #JMP_CTX_X23]
- stp x25, x26, [x0, #JMP_CTX_X25]
- stp x27, x28, [x0, #JMP_CTX_X27]
- stp x29, x30, [x0, #JMP_CTX_X29]
- stp x7, xzr, [x0, #JMP_CTX_SP]
-
- mov x0, #0
- ret
-endfunc setjmp
-
-
-/*
- * void longjmp(jmp_buf env, int val);
- */
-func longjmp
- ldp x7, xzr, [x0, #JMP_CTX_SP]
-
-#if ENABLE_ASSERTIONS
- /*
- * Since we're unwinding the stack, assert that the stack being reset to
- * is shallower.
- */
- mov x19, sp
- cmp x7, x19
- ASM_ASSERT(ge)
-#endif
-
- ldp x19, x20, [x0, #JMP_CTX_X19]
- ldp x21, x22, [x0, #JMP_CTX_X21]
- ldp x23, x24, [x0, #JMP_CTX_X23]
- ldp x25, x26, [x0, #JMP_CTX_X25]
- ldp x27, x28, [x0, #JMP_CTX_X27]
- ldp x29, x30, [x0, #JMP_CTX_X29]
-
- mov sp, x7
-
- ands x0, x1, x1 /* Move val to x0 and set flags */
- cinc x0, x0, eq /* If val is 0, return 1 */
- ret
-endfunc longjmp
--- /dev/null
+/*
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <asm_macros.S>
+#include <assert_macros.S>
+#include <setjmp.h>
+
+ .globl setjmp
+ .globl longjmp
+
+/*
+ * int setjmp(jmp_buf env);
+ */
+func setjmp
+ mov x7, sp
+
+ stp x19, x20, [x0, #JMP_CTX_X19]
+ stp x21, x22, [x0, #JMP_CTX_X21]
+ stp x23, x24, [x0, #JMP_CTX_X23]
+ stp x25, x26, [x0, #JMP_CTX_X25]
+ stp x27, x28, [x0, #JMP_CTX_X27]
+ stp x29, x30, [x0, #JMP_CTX_X29]
+ stp x7, xzr, [x0, #JMP_CTX_SP]
+
+ mov x0, #0
+ ret
+endfunc setjmp
+
+
+/*
+ * void longjmp(jmp_buf env, int val);
+ */
+func longjmp
+ ldp x7, xzr, [x0, #JMP_CTX_SP]
+
+#if ENABLE_ASSERTIONS
+ /*
+ * Since we're unwinding the stack, assert that the stack being reset to
+ * is shallower.
+ */
+ mov x19, sp
+ cmp x7, x19
+ ASM_ASSERT(ge)
+#endif
+
+ ldp x19, x20, [x0, #JMP_CTX_X19]
+ ldp x21, x22, [x0, #JMP_CTX_X21]
+ ldp x23, x24, [x0, #JMP_CTX_X23]
+ ldp x25, x26, [x0, #JMP_CTX_X25]
+ ldp x27, x28, [x0, #JMP_CTX_X27]
+ ldp x29, x30, [x0, #JMP_CTX_X29]
+
+ mov sp, x7
+
+ ands x0, x1, x1 /* Move val to x0 and set flags */
+ cinc x0, x0, eq /* If val is 0, return 1 */
+ ret
+endfunc longjmp
#
-# Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
-LIBC_SRCS := $(addprefix lib/libc/, \
+LIBC_SRCS := $(addprefix lib/libc/, \
abort.c \
assert.c \
exit.c \
strnlen.c \
strrchr.c)
+ifeq (${ARCH},aarch64)
+LIBC_SRCS += $(addprefix lib/libc/aarch64/, \
+ setjmp.S)
+endif
+
INCLUDES += -Iinclude/lib/libc \
-Iinclude/lib/libc/$(ARCH) \
#
-# Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
endef
+# MAKE_S_LIB builds an assembly source file and generates the dependency file
+# $(1) = output directory
+# $(2) = source file (%.S)
+# $(3) = library name
+define MAKE_S_LIB
+$(eval OBJ := $(1)/$(patsubst %.S,%.o,$(notdir $(2))))
+$(eval DEP := $(patsubst %.o,%.d,$(OBJ)))
+
+$(OBJ): $(2) $(filter-out %.d,$(MAKEFILE_LIST)) | lib$(3)_dirs
+ $$(ECHO) " AS $$<"
+ $$(Q)$$(AS) $$(ASFLAGS) $(MAKE_DEP) -c $$< -o $$@
+
+-include $(DEP)
+
+endef
+
# MAKE_C builds a C source file and generates the dependency file
# $(1) = output directory
endef
-# MAKE_LIB_OBJS builds both C source files
+# MAKE_LIB_OBJS builds both C and assembly source files
# $(1) = output directory
# $(2) = list of source files
# $(3) = name of the library
$(eval REMAIN := $(filter-out %.c,$(2)))
$(eval $(foreach obj,$(C_OBJS),$(call MAKE_C_LIB,$(1),$(obj),$(3))))
+ $(eval S_OBJS := $(filter %.S,$(REMAIN)))
+ $(eval REMAIN := $(filter-out %.S,$(REMAIN)))
+ $(eval $(foreach obj,$(S_OBJS),$(call MAKE_S_LIB,$(1),$(obj),$(3))))
+
$(and $(REMAIN),$(error Unexpected source files present: $(REMAIN)))
endef